﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace _20自画图形
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void OnChangeClick(object sender,RoutedEventArgs e)
        {
            SetMouth2();
        }

        private bool _laugh = false;
        private void SetMouth2()
        {
            if(_laugh)
            {
                mouth.Data = Geometry.Parse("M 40,74 Q 57,94,80,74");//贝塞尔曲线
                /*
                 * 贝塞尔曲线坐标解析
                 M 40,70，分别为起点的x,y坐标
                 Q 57,94，分别为中点的x,y坐标
                 80，74，为结束点的x,y坐标    
                */
            }
            else
            {
                mouth.Data = Geometry.Parse("M 40,84 Q 57,60,80,84");
            }
            _laugh = !_laugh;
        }
    }
}
